package com.chauncy.DMS.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.chauncy.DMS.dao.ManagerDaoImplement;

public class DeleteHealthInfoServlet extends HttpServlet {

	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
			
	}


	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		ManagerDaoImplement daoImplement = new ManagerDaoImplement();
		String sql = "DELETE FROM health_info_table" +
				" WHERE health_info_table.Health_info_number = ?;";
			//healthInfoTable唯一ID	
			int healthId = 	0;
			try {
				healthId = Integer.parseInt( request.getParameter("healthId"));
				System.out.println("healthId:"+healthId);
			} catch (Exception e) {
				// TODO: handle exception
			}
			Object [] param = {healthId};
			if(healthId != 0){
				int falg = daoImplement.updata(sql, param);
				response.getWriter().print(falg);
			}
	}

}
